/*
* $Id: HousingManager.h 169 2010-10-16 17:46:54Z volok-aleksej@yandex.ru $
*
* Copyright 2010 by Volokitin Alexey
* All rights reserved
*
*/
#ifndef _HOUSING_MANAGER_H_
#define _HOUSING_MANAGER_H_

#include "JournalInterface.h"

class CHousingManager
{
public:
	struct housing{
		std::tstring m_strName;
		int m_nIdFamily;
		int m_typeHousing;
		int m_typeframes;
		bool m_bDelete;
		housing();
		housing(const housing& hive);
		void operator = (const housing& hive);
	};
private:
	std::map<int, housing> m_aHousings;
	std::map<int, std::vector<int> > m_aFamilyHousing;
	std::map<int, std::tstring> m_aTypeHousing;
	std::map<int, std::tstring> m_aTypeFrame;
public:
	CHousingManager();
	~CHousingManager();
public:
	void Init();
	std::map<int, housing> GetHousings();
	housing GetHousing(int nIdHousing);
	void UpdateHousing(int nId, const housing& hive);
	int AddHousing(const housing& hive);
	void SetFamily(int nId, int nIdFamily);
	void DeleteFamilies(int nIdFamily);
	void DeleteHousing(int nId);
	std::map<int, std::tstring> GetType(Housing::change_type tp);
	std::tstring GetType(Housing::change_type tp, int idType);
	void DeleteType(Housing::change_type tp, int nId);
	void AddType(Housing::change_type tp, const std::tstring& strType);
	std::map<int, housing> GetFamilyHousings(int nIdFamily);
};

#endif/*_HOUSING_MANAGER_H_*/